import { Controller, Get } from '@nestjs/common';
import { definePermission } from '~/modules/auth/decorators/permission.decorator';
import { MenuService } from './menu.service';
import { AuthUser } from '~/modules/auth/decorators/auth-user.decorator';
import { AllowAnon } from '~/modules/auth/decorators/allow-anon.decorator';
export const permissions = definePermission('system:menu', {
  LIST: 'list',
  CREATE: 'create',
  READ: 'read',
  UPDATE: 'update',
  DELETE: 'delete'
} as const);
@Controller('menus')
export class MenuController {
  constructor(private menuService: MenuService) {}
  @Get()
  @AllowAnon()
  async list(@AuthUser() user: IAuthUser) {
    console.log(await this.menuService.getMenus(user.uid));
    const data = await this.menuService.getMenus(user.uid);
    return data;
  }
}
